﻿using System;

namespace viBlog.Classes
{
    /// <summary>
    /// A comment for a blog post
    /// </summary>
    public class Comment
    {
        private int _CommentId;
        /// <summary>
        /// The comment id
        /// </summary>
        public int CommentId
        {
            get { return _CommentId; }
            set { _CommentId = value; }
        }

        private int _PostId;
        /// <summary>
        /// The post Id the comment is associated with
        /// </summary>
        public int PostId
        {
            get { return _PostId; }
            set { _PostId = value; }
        }

        private string _Author;
        /// <summary>
        /// The comment author
        /// </summary>
        public string Author
        {
            get { return _Author; }
            set { _Author = value; }
        }

        private string _Email;
        /// <summary>
        /// The comment author email
        /// </summary>
        public string Email
        {
            get { return _Email; }
            set { _Email = value; }
        }

        private string _Website;
        /// <summary>
        /// The comment author website
        /// </summary>
        public string Website
        {
            get
            {
                if (string.IsNullOrEmpty(_Website))
                    return null;
                else
                {
                    if (_Website.ToLower().StartsWith("http://"))
                        return _Website;
                    else
                        return "http://" + _Website;
                }
            }
            set { _Website = value; }
        }

        private DateTime _Date;
        /// <summary>
        /// The comment posting date
        /// </summary>
        public DateTime Date
        {
            get { return _Date; }
            set { _Date = value; }
        }

        private string _Content;
        /// <summary>
        /// The comment contents
        /// </summary>
        public string Content
        {
            get { return _Content; }
            set { _Content = value; }
        }

        private CommentStatus _Status;
        /// <summary>
        /// The comment status
        /// </summary>
        public CommentStatus Status
        {
            get { return _Status; }
            set { _Status = value; }
        }

        private string _Url;
        /// <summary>
        /// The comment url
        /// </summary>
        public string Url
        {
            get { return _Url; }
            set { _Url = value; }
        }
        
        public enum CommentStatus
        {
            Pending = 0,
            Approved = 1,            
            Spam = 3,
            Deleted = 4
        }
    }
}
